<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MQTT C Client Libraries Internals: Thread.c File Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="pahologo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MQTT C Client Libraries Internals
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

</div><!-- top -->
<div class="header">
  <div class="summary">
<a href="#define-members">Macros</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Thread.c File Reference</div>  </div>
</div><!--header-->
<div class="contents">

<p>Threading related functions.  
<a href="#details">More...</a></p>
<div class="textblock"><code>#include &quot;Thread.h&quot;</code><br />
<code>#include &quot;Log.h&quot;</code><br />
<code>#include &quot;StackTrace.h&quot;</code><br />
<code>#include &lt;errno.h&gt;</code><br />
<code>#include &lt;unistd.h&gt;</code><br />
<code>#include &lt;sys/time.h&gt;</code><br />
<code>#include &lt;fcntl.h&gt;</code><br />
<code>#include &lt;stdio.h&gt;</code><br />
<code>#include &lt;sys/stat.h&gt;</code><br />
<code>#include &lt;limits.h&gt;</code><br />
<code>#include &lt;stdlib.h&gt;</code><br />
<code>#include &quot;OsWrapper.h&quot;</code><br />
</div><div class="textblock"><div class="dynheader">
Include dependency graph for Thread.c:</div>
<div class="dyncontent">
<div class="center"><img src="Thread_8c__incl.png" border="0" usemap="#aThread_8c" alt=""/></div>
<map name="aThread_8c" id="aThread_8c">
<area shape="rect" title="Threading related functions." alt="" coords="321,5,393,32"/>
<area shape="rect" title=" " alt="" coords="5,80,67,107"/>
<area shape="rect" title=" " alt="" coords="91,80,157,107"/>
<area shape="rect" title=" " alt="" coords="182,80,263,107"/>
<area shape="rect" title=" " alt="" coords="287,80,345,107"/>
<area shape="rect" title=" " alt="" coords="369,80,429,107"/>
<area shape="rect" title=" " alt="" coords="453,80,531,107"/>
<area shape="rect" title=" " alt="" coords="555,80,618,107"/>
<area shape="rect" title=" " alt="" coords="642,80,705,107"/>
</map>
</div>
</div><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a342744cc2c60c981c4558475a759ca6c"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a342744cc2c60c981c4558475a759ca6c">Paho_thread_start</a> (thread_fn fn, void *parameter)</td></tr>
<tr class="memdesc:a342744cc2c60c981c4558475a759ca6c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Start a new thread.  <a href="Thread_8c.html#a342744cc2c60c981c4558475a759ca6c">More...</a><br /></td></tr>
<tr class="separator:a342744cc2c60c981c4558475a759ca6c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4bd33fc4aeea77c32f7145bc8582b535"><td class="memItemLeft" align="right" valign="top"><a id="a4bd33fc4aeea77c32f7145bc8582b535"></a>
int&#160;</td><td class="memItemRight" valign="bottom"><b>Thread_set_name</b> (const char *thread_name)</td></tr>
<tr class="separator:a4bd33fc4aeea77c32f7145bc8582b535"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4dc03e919803e0af06fabbd4f394a51c"><td class="memItemLeft" align="right" valign="top">mutex_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a4dc03e919803e0af06fabbd4f394a51c">Paho_thread_create_mutex</a> (int *rc)</td></tr>
<tr class="memdesc:a4dc03e919803e0af06fabbd4f394a51c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new mutex.  <a href="Thread_8c.html#a4dc03e919803e0af06fabbd4f394a51c">More...</a><br /></td></tr>
<tr class="separator:a4dc03e919803e0af06fabbd4f394a51c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c9cd0a1556e72719a5ed3f9cdf6686f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a1c9cd0a1556e72719a5ed3f9cdf6686f">Paho_thread_lock_mutex</a> (mutex_type mutex)</td></tr>
<tr class="memdesc:a1c9cd0a1556e72719a5ed3f9cdf6686f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Lock a mutex which has alrea.  <a href="Thread_8c.html#a1c9cd0a1556e72719a5ed3f9cdf6686f">More...</a><br /></td></tr>
<tr class="separator:a1c9cd0a1556e72719a5ed3f9cdf6686f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1c21203efa0c10544d24585870fe4757"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a1c21203efa0c10544d24585870fe4757">Paho_thread_unlock_mutex</a> (mutex_type mutex)</td></tr>
<tr class="memdesc:a1c21203efa0c10544d24585870fe4757"><td class="mdescLeft">&#160;</td><td class="mdescRight">Unlock a mutex which has already been locked.  <a href="Thread_8c.html#a1c21203efa0c10544d24585870fe4757">More...</a><br /></td></tr>
<tr class="separator:a1c21203efa0c10544d24585870fe4757"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad2c1a28aa3f8ae9cdd6677fd5477b8e4"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ad2c1a28aa3f8ae9cdd6677fd5477b8e4">Paho_thread_destroy_mutex</a> (mutex_type mutex)</td></tr>
<tr class="memdesc:ad2c1a28aa3f8ae9cdd6677fd5477b8e4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a mutex which has already been created.  <a href="Thread_8c.html#ad2c1a28aa3f8ae9cdd6677fd5477b8e4">More...</a><br /></td></tr>
<tr class="separator:ad2c1a28aa3f8ae9cdd6677fd5477b8e4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aa3e166167a73a02b488d49e724d161c4"><td class="memItemLeft" align="right" valign="top">thread_id_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#aa3e166167a73a02b488d49e724d161c4">Paho_thread_getid</a> (void)</td></tr>
<tr class="memdesc:aa3e166167a73a02b488d49e724d161c4"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the thread id of the thread from which this function is called.  <a href="Thread_8c.html#aa3e166167a73a02b488d49e724d161c4">More...</a><br /></td></tr>
<tr class="separator:aa3e166167a73a02b488d49e724d161c4"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3b9b6cb543ee55442d2037a971f651db"><td class="memItemLeft" align="right" valign="top">sem_type&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a3b9b6cb543ee55442d2037a971f651db">Thread_create_sem</a> (int *rc)</td></tr>
<tr class="memdesc:a3b9b6cb543ee55442d2037a971f651db"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new semaphore.  <a href="Thread_8c.html#a3b9b6cb543ee55442d2037a971f651db">More...</a><br /></td></tr>
<tr class="separator:a3b9b6cb543ee55442d2037a971f651db"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4d0bbfc059da3cd10626244d3468d319"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a4d0bbfc059da3cd10626244d3468d319">Thread_wait_sem</a> (sem_type sem, int timeout)</td></tr>
<tr class="memdesc:a4d0bbfc059da3cd10626244d3468d319"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait for a semaphore to be posted, or timeout.  <a href="Thread_8c.html#a4d0bbfc059da3cd10626244d3468d319">More...</a><br /></td></tr>
<tr class="separator:a4d0bbfc059da3cd10626244d3468d319"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad327c467c568b27be4c3676fc698e129"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ad327c467c568b27be4c3676fc698e129">Thread_check_sem</a> (sem_type sem)</td></tr>
<tr class="memdesc:ad327c467c568b27be4c3676fc698e129"><td class="mdescLeft">&#160;</td><td class="mdescRight">Check to see if a semaphore has been posted, without waiting The semaphore will be unchanged, if the return value is false.  <a href="Thread_8c.html#ad327c467c568b27be4c3676fc698e129">More...</a><br /></td></tr>
<tr class="separator:ad327c467c568b27be4c3676fc698e129"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ac023f527bed9c6c3a20244fa7efe272c"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ac023f527bed9c6c3a20244fa7efe272c">Thread_post_sem</a> (sem_type sem)</td></tr>
<tr class="memdesc:ac023f527bed9c6c3a20244fa7efe272c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Post a semaphore.  <a href="Thread_8c.html#ac023f527bed9c6c3a20244fa7efe272c">More...</a><br /></td></tr>
<tr class="separator:ac023f527bed9c6c3a20244fa7efe272c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad075ec07f801ac1a2a7dee7097048182"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#ad075ec07f801ac1a2a7dee7097048182">Thread_destroy_sem</a> (sem_type sem)</td></tr>
<tr class="memdesc:ad075ec07f801ac1a2a7dee7097048182"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a semaphore which has already been created.  <a href="Thread_8c.html#ad075ec07f801ac1a2a7dee7097048182">More...</a><br /></td></tr>
<tr class="separator:ad075ec07f801ac1a2a7dee7097048182"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:afdd152c518f968c777012d7dfb20ef96"><td class="memItemLeft" align="right" valign="top"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#afdd152c518f968c777012d7dfb20ef96">Thread_create_cond</a> (int *rc)</td></tr>
<tr class="memdesc:afdd152c518f968c777012d7dfb20ef96"><td class="mdescLeft">&#160;</td><td class="mdescRight">Create a new condition variable.  <a href="Thread_8c.html#afdd152c518f968c777012d7dfb20ef96">More...</a><br /></td></tr>
<tr class="separator:afdd152c518f968c777012d7dfb20ef96"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7b0d40dc1603a6e93db0ee970bb6750f"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a7b0d40dc1603a6e93db0ee970bb6750f">Thread_signal_cond</a> (<a class="el" href="structcond__type__struct.html">cond_type</a> condvar)</td></tr>
<tr class="memdesc:a7b0d40dc1603a6e93db0ee970bb6750f"><td class="mdescLeft">&#160;</td><td class="mdescRight">Signal a condition variable.  <a href="Thread_8c.html#a7b0d40dc1603a6e93db0ee970bb6750f">More...</a><br /></td></tr>
<tr class="separator:a7b0d40dc1603a6e93db0ee970bb6750f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acd23266878de6faaee0a972ef74c4db6"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#acd23266878de6faaee0a972ef74c4db6">Thread_wait_cond</a> (<a class="el" href="structcond__type__struct.html">cond_type</a> condvar, int timeout_ms)</td></tr>
<tr class="memdesc:acd23266878de6faaee0a972ef74c4db6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Wait with a timeout (ms) for condition variable.  <a href="Thread_8c.html#acd23266878de6faaee0a972ef74c4db6">More...</a><br /></td></tr>
<tr class="separator:acd23266878de6faaee0a972ef74c4db6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a95309628f2c15de1f3ea8047b086a707"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="Thread_8c.html#a95309628f2c15de1f3ea8047b086a707">Thread_destroy_cond</a> (<a class="el" href="structcond__type__struct.html">cond_type</a> condvar)</td></tr>
<tr class="memdesc:a95309628f2c15de1f3ea8047b086a707"><td class="mdescLeft">&#160;</td><td class="mdescRight">Destroy a condition variable.  <a href="Thread_8c.html#a95309628f2c15de1f3ea8047b086a707">More...</a><br /></td></tr>
<tr class="separator:a95309628f2c15de1f3ea8047b086a707"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>Threading related functions. </p>
<p>Used to create platform independent threading functions </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a4dc03e919803e0af06fabbd4f394a51c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4dc03e919803e0af06fabbd4f394a51c">&#9670;&nbsp;</a></span>Paho_thread_create_mutex()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">mutex_type Paho_thread_create_mutex </td>
          <td>(</td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>rc</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a new mutex. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">rc</td><td>return code: 0 for success, negative otherwise </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new mutex </dd></dl>

</div>
</div>
<a id="ad2c1a28aa3f8ae9cdd6677fd5477b8e4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad2c1a28aa3f8ae9cdd6677fd5477b8e4">&#9670;&nbsp;</a></span>Paho_thread_destroy_mutex()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Paho_thread_destroy_mutex </td>
          <td>(</td>
          <td class="paramtype">mutex_type&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroy a mutex which has already been created. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mutex</td><td>the mutex </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="aa3e166167a73a02b488d49e724d161c4"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aa3e166167a73a02b488d49e724d161c4">&#9670;&nbsp;</a></span>Paho_thread_getid()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">thread_id_type Paho_thread_getid </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Get the thread id of the thread from which this function is called. </p>
<dl class="section return"><dt>Returns</dt><dd>thread id, type varying according to OS </dd></dl>

</div>
</div>
<a id="a1c9cd0a1556e72719a5ed3f9cdf6686f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c9cd0a1556e72719a5ed3f9cdf6686f">&#9670;&nbsp;</a></span>Paho_thread_lock_mutex()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Paho_thread_lock_mutex </td>
          <td>(</td>
          <td class="paramtype">mutex_type&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Lock a mutex which has alrea. </p>
<dl class="section return"><dt>Returns</dt><dd>completion code, 0 is success </dd></dl>

</div>
</div>
<a id="a342744cc2c60c981c4558475a759ca6c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a342744cc2c60c981c4558475a759ca6c">&#9670;&nbsp;</a></span>Paho_thread_start()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Paho_thread_start </td>
          <td>(</td>
          <td class="paramtype">thread_fn&#160;</td>
          <td class="paramname"><em>fn</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>parameter</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Start a new thread. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">fn</td><td>the function to run, must be of the correct signature </td></tr>
    <tr><td class="paramname">parameter</td><td>pointer to the function parameter, can be NULL </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="a1c21203efa0c10544d24585870fe4757"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1c21203efa0c10544d24585870fe4757">&#9670;&nbsp;</a></span>Paho_thread_unlock_mutex()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Paho_thread_unlock_mutex </td>
          <td>(</td>
          <td class="paramtype">mutex_type&#160;</td>
          <td class="paramname"><em>mutex</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Unlock a mutex which has already been locked. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">mutex</td><td>the mutex </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>completion code, 0 is success </dd></dl>

</div>
</div>
<a id="ad327c467c568b27be4c3676fc698e129"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad327c467c568b27be4c3676fc698e129">&#9670;&nbsp;</a></span>Thread_check_sem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Thread_check_sem </td>
          <td>(</td>
          <td class="paramtype">sem_type&#160;</td>
          <td class="paramname"><em>sem</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Check to see if a semaphore has been posted, without waiting The semaphore will be unchanged, if the return value is false. </p>
<p>The semaphore will have been decremented, if the return value is true. </p><dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 (false) or 1 (true) </dd></dl>

</div>
</div>
<a id="afdd152c518f968c777012d7dfb20ef96"></a>
<h2 class="memtitle"><span class="permalink"><a href="#afdd152c518f968c777012d7dfb20ef96">&#9670;&nbsp;</a></span>Thread_create_cond()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="structcond__type__struct.html">cond_type</a> Thread_create_cond </td>
          <td>(</td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>rc</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a new condition variable. </p>
<dl class="section return"><dt>Returns</dt><dd>the condition variable struct </dd></dl>
<div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
<div class="center"><img src="Thread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph.png" border="0" usemap="#aThread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph" alt=""/></div>
<map name="aThread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph" id="aThread_8c_afdd152c518f968c777012d7dfb20ef96_cgraph">
<area shape="rect" title="Create a new condition variable." alt="" coords="5,5,145,32"/>
<area shape="rect" href="Log_8c.html#a669722e3f57811871f97c12392aba85d" title="Log a message." alt="" coords="193,5,237,32"/>
</map>
</div>

</div>
</div>
<a id="a3b9b6cb543ee55442d2037a971f651db"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3b9b6cb543ee55442d2037a971f651db">&#9670;&nbsp;</a></span>Thread_create_sem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">sem_type Thread_create_sem </td>
          <td>(</td>
          <td class="paramtype">int *&#160;</td>
          <td class="paramname"><em>rc</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Create a new semaphore. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">rc</td><td>return code: 0 for success, negative otherwise </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the new condition variable </dd></dl>

</div>
</div>
<a id="a95309628f2c15de1f3ea8047b086a707"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a95309628f2c15de1f3ea8047b086a707">&#9670;&nbsp;</a></span>Thread_destroy_cond()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Thread_destroy_cond </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td>
          <td class="paramname"><em>condvar</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroy a condition variable. </p>
<dl class="section return"><dt>Returns</dt><dd>completion code </dd></dl>

</div>
</div>
<a id="ad075ec07f801ac1a2a7dee7097048182"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ad075ec07f801ac1a2a7dee7097048182">&#9670;&nbsp;</a></span>Thread_destroy_sem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Thread_destroy_sem </td>
          <td>(</td>
          <td class="paramtype">sem_type&#160;</td>
          <td class="paramname"><em>sem</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Destroy a semaphore which has already been created. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ac023f527bed9c6c3a20244fa7efe272c"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ac023f527bed9c6c3a20244fa7efe272c">&#9670;&nbsp;</a></span>Thread_post_sem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Thread_post_sem </td>
          <td>(</td>
          <td class="paramtype">sem_type&#160;</td>
          <td class="paramname"><em>sem</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Post a semaphore. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on success </dd></dl>

</div>
</div>
<a id="a7b0d40dc1603a6e93db0ee970bb6750f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a7b0d40dc1603a6e93db0ee970bb6750f">&#9670;&nbsp;</a></span>Thread_signal_cond()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Thread_signal_cond </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td>
          <td class="paramname"><em>condvar</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Signal a condition variable. </p>
<dl class="section return"><dt>Returns</dt><dd>completion code </dd></dl>

</div>
</div>
<a id="acd23266878de6faaee0a972ef74c4db6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acd23266878de6faaee0a972ef74c4db6">&#9670;&nbsp;</a></span>Thread_wait_cond()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Thread_wait_cond </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structcond__type__struct.html">cond_type</a>&#160;</td>
          <td class="paramname"><em>condvar</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>timeout_ms</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Wait with a timeout (ms) for condition variable. </p>
<dl class="section return"><dt>Returns</dt><dd>0 for success, ETIMEDOUT otherwise </dd></dl>

</div>
</div>
<a id="a4d0bbfc059da3cd10626244d3468d319"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a4d0bbfc059da3cd10626244d3468d319">&#9670;&nbsp;</a></span>Thread_wait_sem()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int Thread_wait_sem </td>
          <td>(</td>
          <td class="paramtype">sem_type&#160;</td>
          <td class="paramname"><em>sem</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">int&#160;</td>
          <td class="paramname"><em>timeout</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Wait for a semaphore to be posted, or timeout. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">sem</td><td>the semaphore </td></tr>
    <tr><td class="paramname">timeout</td><td>the maximum time to wait, in milliseconds </td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>completion code </dd></dl>

</div>
</div>
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Oct 13 2023 18:02:53 for MQTT C Client Libraries Internals by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
